package com.zxy.config;

import com.alibaba.cloud.nacos.ribbon.NacosRule;
import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import com.netflix.loadbalancer.RoundRobinRule;
import com.zxy.rule.MyRule;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.cloud.netflix.ribbon.RibbonClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

//@Configuration
//@RibbonClient(name = "nacos-a",configuration = MyRule.class)
//@RibbonClients(defaultConfiguration = RoundRobinRule.class)//全局定义负载规则
public class RibbonConfig {

    //@Bean //全局定义负载规则
    public IRule rule(){
//        return new NacosRule();
//        return new RandomRule();
        return new RoundRobinRule();//默认轮询
//        return new MyRule();
    }
}
